package models

import (
	"github.com/goravel/framework/contracts/database/factory"
	"github.com/goravel/framework/database/orm"
	"goravel/database/factories"
)

type User struct {
	orm.Model
	Name     string   `gorm:"column:name;type:varchar(255);null;default:'';comment:'姓名'" form:"name" json:"name"`
	Mobile   string   `gorm:"column:mobile;type:varchar(255);null;default:'';comment:'手机号'" form:"mobile" json:"mobile"`
	Password string   `gorm:"column:password;type:varchar(255);null;default:'';comment:'密码'" form:"password" json:"password"`
	Unionid  string   `gorm:"column:unionid;type:varchar(255);null;default:'';comment:'unionid'" form:"unionid" json:"unionid"`
	Openid   string   `gorm:"column:openid;type:varchar(255);null;default:'';comment:'openid'" form:"openid" json:"openid"`
	Tickets  []Ticket `gorm:"many2many:ticket_user;" form:"tickets" json:"tickets"`
	Roles    []*Role  `gorm:"many2many:role_user" form:"roles" json:"roles"`
	orm.SoftDeletes
}

func (*User) Factory() factory.Factory {
	return &factories.UserFactory{}
}

const (
	DRIVER        = "driver"        //驾驶员
	CLASS_ROLE    = "class_role"    // 维修班班长
	FLOW_ROLE     = "flow_role"     // 维修作业长
	EMPLOYEE_ROLE = "employee_role" // 维修工
)
